﻿@section HeaderSection
   {
    <link href="../Content/Styles/create_poll_page.css" rel="stylesheet" type="text/css" />
   }
   <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
@model RipPoll.Library.PollPE
           
<script type="text/javascript">
    var choiceCount = 4

    $(document).ready(function () {

        $('input[id=totalchoicecount]').val(choiceCount);

        $('a[id=gonext]').click(function () {
            $('form#create3Form').submit();
            return false;
        });

        $('input[id="yes"]').click(function () {
            $('input[type="text"]').attr("disabled", "disabled");
        });

        $('input[id="multi"]').click(function () {
            $('input[type="text"]').removeAttr("disabled");
        });

        $('img[id=moreimages]').click(function () {
            choiceCount++;
            divBody = document.getElementById("divchoices");
            textnode1 = document.createElement("input");
            textnode1.id = "answer"
            textnode1.name = "choice" + choiceCount;
            textnode1.type = "text";
            divBody.appendChild(textnode1);
            $("#totalchoicecount").val(choiceCount);

            var brdiv = document.createElement('div');
            brdiv.innerHTML = "<br />";
            divBody.appendChild(brdiv);

        });

        $('input[name*="choice"]').focus(function () {
            $(this).val("");
        });

//        $('input[name*="choice"]').focusout(function () {
//            if ($(this).val() == "") {
//                $(this).val("Fill in your answer");
//            }
//        });


    });
 </script>
@{
    ViewBag.Title = "   Create Poll";
    ViewBag.PageDivId = "headerCreatePoll2";
    ViewBag.Margin = "";
} 


  <form id="create3Form" action="create3" method="post">

  <div id="stepBoxMain">
 <img src="../content/images/rippoll_icon_black.jpg" width="56" height="51" align="middle" /><span class="topText"> You're on your way to making a
  rippoll that just might bring about a change in today's society.</span> <br />
</div>

<div id="createPageLeft">

<div class="stepBoxText" id="stepBox">
  <a href="/rippollwebmvc/poll/create1">1. Pick a category</a></div>

<div class="stepBoxText" id="stepBox">
  <a href="/rippollwebmvc/poll/create2">2. Create your question</a></div>

<div class="stepBoxText" id="stepBox1">
3. Choose your format</div>

@if (Model != null && Model.Choices != null)
{
<div class="stepBoxText" id="stepBox">
<a href="../Poll/create4">4. Enhance your rippoll</a></div>
}
else
{
<div class="stepBoxText" id="stepBox">
4. Enhance your rippoll</div>
}
Click one of the above to go back and edit a previous step
</div>

<div id="createPageRight">
 <img src="../content/images/step_3.jpg" width="304" height="42" />
 
 <div id="inputBox"><span class="blueBoldText">Choose your format</span> 
 <span class="mediumGreyText">Pick between 2 answer formats for your rippoll</span>
   
        @if (Model != null && Model.ChoiceGroupId == 1)
        {
            <span class="redText"><br />
              <br /> 
            <label>
            <input type="radio" name="rdCh" id="yes" value="1" checked="checked" />
            </label>
            </span>
            <span class="category">
            Yes/No</span><span class="redText"><br />
            <br /></span>
            <label>
            <input type="radio" name="rdCh" id="multi" value="3" />
            </label>
            <span class="category"> Multiple choice answers (fill in the answer options)</span><br />
            <br />
        }
        else if (Model != null && Model.ChoiceGroupId == 3)
            {
            <span class="redText"><br />
              <br /> 
            <label>
            <input type="radio" name="rdCh" id="yes" value="1" />
            </label>
            </span>
            <span class="category">
            Yes/No</span><span class="redText"><br />
            <br /></span>
            <label>
            <input type="radio" name="rdCh" id="multi" value="3" checked="checked" />
            </label>
            <span class="category"> Multiple choice answers (fill in the answer options)</span><br />
            <br />
            }
            else 
            {
            <span class="redText"><br />
              <br /> 
            <label>
            <input type="radio" name="rdCh" id="yes" value="1" />
            </label>
            </span>
            <span class="category">
            Yes/No</span><span class="redText"><br />
            <br /></span>
            <label>
            <input type="radio" name="rdCh" id="multi" value="3" />
            </label>
            <span class="category"> Multiple choice answers (fill in the answer options)</span><br />
            <br />
            }
   
   @if (Model != null && Model.ChoiceGroupId > 2 && Model.Choices != null && Model.Choices.Count > 0)
   {
       var v = Model.Choices[0].Choice;
 <label>
   <input id="answer" type="text" name="choice1" value=@v />
 </label>
   }
   else
   {
       <input id="answer" type="text" name="choice1" value="Fill in your answer" />
   }
 <br />
 <br />
   @if (Model != null && Model.ChoiceGroupId > 2 && Model.Choices != null && Model.Choices.Count > 1)
   {
       var v = Model.Choices[1].Choice;
  <input id="answer" type="text" name="choice2" value="@v" />
   }
   else
   {
       <input id="answer" type="text" name="choice2" value="Fill in your answer" />
   }
 <br />
 <br />
 @if (Model != null && Model.ChoiceGroupId > 2 && Model.Choices != null && Model.Choices.Count > 2)
 {
     var v = ((RipPoll.Library.PollPE)Model).Choices[2].Choice;
 <input id="answer" type="text" name="choice3" value="@v" />
 }
 else
 {
     <input id="answer" type="text" name="choice3" value="Fill in your answer" />
 }
 <br />
 <span class="verySmallText"><br />
 @if (Model != null && Model.ChoiceGroupId > 2 &&  Model.Choices != null && Model.Choices.Count > 3)
 {
     var v = Model.Choices[3].Choice;
 <input id="answer" type="text" name="choice4" value="@v" />
 }
 else
 {
     <input id="answer" type="text" name="choice4" value="Fill in your answer" />
 }
 <br />
 <br />
 </span>
 <div id="divchoices">
    @if(Model != null && Model.ChoiceGroupId > 2 && Model.Choices != null && Model.Choices.Count > 4)
    {
        for(int index=5; index<=Model.Choices.Count; index++)
        { var val = Model.Choices[index-1].Choice;
        var ctname = "choice" + index.ToString();
            <input id="answer" type="text" name="@ctname" value="@val" />
            <br />
            <br />
        }
    }    
 </div>
 <br />
<div id="more"><img src="../Content/images/more.jpg" width="68" height="24" alt="More" id="moreimages" /></div>
                            <br />
                            <br />
       <a id="gonext"><img src="../Content/images/go_to_step_4.jpg" alt="Click here to go to Step 2" width="200" height="28" border="0" /></a></div>
 <br />
 <span class="viewCategory"><strong><br />
 <br />
 <br />
 <br />
 Learn how to make your rippoll look great.</strong></span> <br />
Read our <span class="blueHiliteText"><a href="#">recommended settings</a>.</span><br />
     <br />
     <span class="viewCategory"><strong>Still have questions?</strong></span> <span class="blueHiliteText"><a href="#">Watch this tutorial</a></span> or <span class="blueHiliteText"><a href="#">ask for help</a></span>.</div>

  <div id="stepBoxMain">
    <span class="regularText">All polls submitted will be reviewed by our internal audit dept. to make sure they’re not slanderous, malicious, derogatory and basically in poor taste.  Keep it clean.  We want our polls to be taken seriously, since they may deal with local, state, national and worldwide issues.  We strive very hard to make sure that this is a positive experience for those submitting polls and those viewing  and responding to your polls.</span>
</div>

<input type="hidden" runat="server" id="totalchoicecount" />

    </form>